import reqVerifyApi from '../../api/verifyApi'
import { OK_CODE } from '@/app/keys'
import { ref } from 'vue'

const useVerify = () => {

  const verify_image = ref('')
  const verify_image_id = ref('')

  const verify_refresh = async () => {
    try {
      const { code, data } = await reqVerifyApi()
      if (code === OK_CODE) {
        verify_image.value = data.img
        verify_image_id.value = data.id
      }
    } catch (error) {
      console.error(error)
    }
  }

  verify_refresh()

  return {
    verify_image,
    verify_image_id,
    verify_refresh,
  }
}

export default useVerify
